import React, { Component } from 'react'
import PropTypes from 'prop-types'   //类型检查
import ReactDOM from 'react-dom'
import { Provider, useSelector, useStore } from 'react-redux'
import {
  HashRouter as Router,
  Link,
  Route,
  BrowserRouter,
} from "react-router-dom";
import { createStore } from 'redux';

function Home() {

  const store = useStore()
  const count = useSelector(state=>{
    return state.count
  })
  console.log(store.getState())

  return (
    <div>
      <ul className="menu">
        <li>
          <Link to="/Home">home</Link>
        </li>
      </ul>
      <div>
        {/* 这样写，不会自动更新 */}
        {/* {store.getState().count}<br/> */}
        {count}
      </div>
      <div>
        <button onClick={()=>{
          store.dispatch({type:'increase'})
        }}>add</button>
      </div>
    </div>
  );
}
export default Home;
